﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;  // 新增命名空间引用

namespace Novel.Server.Models;

public class Comment
{
    public int CommentId { get; set; }

    public int AuthorId { get; set; }

    [Required]
    public int ChapterId { get; set; }
    
    [Required(ErrorMessage = "评论内容不能为空")] 
    [StringLength(1000, MinimumLength = 5, ErrorMessage = "评论内容需在5-1000字符之间")]
    public string Content { get; set; } = string.Empty;

    public DateTime CreatedAt { get; set; }

    public bool IsDeleted { get; set; }

    public virtual User Author { get; set; } = null!;

    public virtual Chapter Chapter { get; set; } = null!;
}
